-
-
Notifications
You must be signed in to change notification settings - Fork 12
Support full constraint syntax of library.properties depends
field
#384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
per1234
merged 5 commits into
arduino:main
from
per1234:full-depends-constraints-support
May 26, 2022
Merged
Support full constraint syntax of library.properties depends
field
#384
per1234
merged 5 commits into
arduino:main
from
per1234:full-depends-constraints-support
May 26, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
At the time the dependency on `go.bug.st/relaxed-semver` was added to the project, there was not a release version available, so it was necessary to use a "pseudo-version" instead. Since that time, the first release of `go.bug.st/relaxed-semver`, offering the opportunity for more effective management of the dependency: - Greater stability through the use of release versions - Automated update offers from Dependabot The relevant changes made to `go.bug.st/relaxed-semver` in the interim have been the expansion of the version constraints syntax, so it will be important for Arduino Lint to use the same version as `arduino/libraries-repository-engine` and Arduino CLI in order to correctly lint the constraints syntax used in the library.properties `depends` field.
This will allow the code to be shared by additional rule functions which need this data.
… field elements Empty version constraints are supported by the Arduino library system (they match any version). Previously, the regular expression used to split the library name from the version constraint caused these empty constraints to incorrectly be considered invalid.
Arduino CLI and the Library Manager system have support for specifying version constraints in the library.properties `depends` field. This was previously validated as part of the general `depends` field data format check in LP047. The constraint system has recently been made much more capable through the addition of support for more syntax. The previous approach for validating the version constraint was a complex and lengthy regular expression in the library.properties JSON schema. Extending this to comprehensively validate the full range of constraint forms possible with the new syntax will not be feasible or maintainable. The new approach is to validate it using the same `go.bug.st/relaxed-semver` module used by Arduino CLI and `arduino/libraries-repository-engine` to handle the version constraints in this field.
…ibrary.properties schema A regular expression is employed in the library.properties JSON schemas to validate the format of the contents of the depends field. Previously, this regular expression was configured to validate the syntax of the optional version constraint. The constraint system has recently been made much more capable through the addition of support for more syntax. The regular expression did not have support for that syntax, which caused valid data to fail validation. Expanding the already complex and lengthy regular expression to comprehensively validate the full range of constraint forms possible with the new syntax would not be feasible or maintainable. The new approach is to validate it directly via Go code using the same `go.bug.st/relaxed-semver` module used by Arduino CLI and `arduino/libraries-repository-engine` to handle the version constraints in this field. The schema will continue to provide a general validation on the `depends` field format.
Codecov Report
@@ Coverage Diff @@
## main #384 +/- ##
==========================================
+ Coverage 90.01% 90.05% +0.04%
==========================================
Files 44 44
Lines 6770 6800 +30
==========================================
+ Hits 6094 6124 +30
Misses 553 553
Partials 123 123
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
umbynos
approved these changes
May 26, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Arduino CLI and the Library Manager system have support for specifying library dependency version constraints in the
depends
field of thelibrary.properties
metadata file.This was previously validated as part of the general
depends
field data format check in ruleLP047
.The constraint system has recently been made much more capable through the addition of support for more syntax.
The previous approach for validating the version constraint was a complex and lengthy regular expression in the
library.properties
JSON schema. Extending this to comprehensively validate the full range of constraint forms possible with the new syntax will not be feasible or maintainable.The new approach is to validate it using the same
go.bug.st/relaxed-semver
module used by Arduino CLI andarduino/libraries-repository-engine
to check the version constraint syntax in this field.The JSON schema based
LP047
is now used solely for validating the data format of thedepends
field. A new ruleLP058
is dedicated to checking the version constraint syntax within each of the field items.